<?php
namespace frontend\controllers;

use Yii;
use yii\web\Controller;
use common\models\Cartoon;
use yii\web\NotFoundHttpException;

/**
 * Cartoon controller
 */
class CartoonController extends BaseController
{
    
    //列表页
    public function actionList()
    {
        return $this->render('list');
    }
    
    //内页
    public function actionDetail($id)
    {
        $model = Cartoon::findOne($id);
        if(empty($model)){
            throw new NotFoundHttpException('页面找不到！');
        }
        
        return $this->render('detail', [
            'model' => $model,
        ]);
    }
    
    //播放页
    public function actionView($cid,$id)
    {
        $cartoon = Cartoon::findOne($cid);
        if(empty($cartoon)){
            throw new NotFoundHttpException('页面找不到！');
        }
        return $this->render('view', [
            'cartoon' => $cartoon,
        ]);
    }
    
}
